Get the factorial of a non-negative integerΒΆ
Get the factorial of a non-negative integer.
def factorial(N):
if N <= 1:
return 1
else:
return N * (factorial(N - 1))
# test
print(factorial(5)) # 120
def factorial(N):
if N <= 1:
return 1
else:
return N * (factorial(N - 1))
# test
print(factorial(5)) # 120